
function includes(object,ch){
  for(let valueItem in object){
    for(let item of object[valueItem])
      if(item === ch){
        return true;
      }
  }
  return false;
}
function collect_same_elements(collection_a, object_b) {
  let result =[];
  for(let objectItem of collection_a){
    for(let valueItem in objectItem){
      if( includes(object_b, objectItem[valueItem]) ){
        result.push(objectItem[valueItem]);
      }
    }
  }
  return result;
}

module.exports = collect_same_elements;
